package org.example.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 贷款数据分析实体类（按月份和职业分类）
 * 
 * @author Generated
 */
@Data
@TableName("loan_analysis_data")
public class LoanAnalysisData {
    
    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    
    /**
     * 放款月份，格式：YYYY-MM
     */
    @TableField("loan_month")
    private String loanMonth;
    
    /**
     * 分类类型（月份数据为NULL，职业分类为具体职业名称）
     */
    @TableField("category_type")
    private String categoryType;
    
    /**
     * 贷款金额
     */
    @TableField("loan_amount")
    private BigDecimal loanAmount;
    
    /**
     * 贷款笔数
     */
    @TableField("loan_count")
    private Integer loanCount;
    
    /**
     * 当前时点余额
     */
    @TableField("current_balance")
    private BigDecimal currentBalance;
    
    /**
     * 余额对应的客户数
     */
    @TableField("balance_customer_count")
    private Integer balanceCustomerCount;
    
    /**
     * 余额占比（%）
     */
    @TableField("balance_ratio")
    private BigDecimal balanceRatio;
    
    /**
     * 客户数占比（%）
     */
    @TableField("customer_count_ratio")
    private BigDecimal customerCountRatio;
    
    /**
     * 逾期[1-30]天的金额
     */
    @TableField("overdue_1_30_amount")
    private BigDecimal overdue1To30Amount;
    
    /**
     * 逾期[1-30]天的客户数
     */
    @TableField("overdue_1_30_customers")
    private Integer overdue1To30Customers;
    
    /**
     * 逾期[31-60]天的金额
     */
    @TableField("overdue_31_60_amount")
    private BigDecimal overdue31To60Amount;
    
    /**
     * 逾期[31-60]天的客户数
     */
    @TableField("overdue_31_60_customers")
    private Integer overdue31To60Customers;
    
    /**
     * 逾期[61-90]天的金额
     */
    @TableField("overdue_61_90_amount")
    private BigDecimal overdue61To90Amount;
    
    /**
     * 逾期[61-90]天的客户数
     */
    @TableField("overdue_61_90_customers")
    private Integer overdue61To90Customers;
    
    /**
     * 逾期[91-120]天的金额
     */
    @TableField("overdue_91_120_amount")
    private BigDecimal overdue91To120Amount;
    
    /**
     * 逾期[91-120]天的客户数
     */
    @TableField("overdue_91_120_customers")
    private Integer overdue91To120Customers;
    
    /**
     * 逾期[121-150]天的金额
     */
    @TableField("overdue_121_150_amount")
    private BigDecimal overdue121To150Amount;
    
    /**
     * 逾期[121-150]天的客户数
     */
    @TableField("overdue_121_150_customers")
    private Integer overdue121To150Customers;
    
    /**
     * 逾期[151-180]天的金额
     */
    @TableField("overdue_151_180_amount")
    private BigDecimal overdue151To180Amount;
    
    /**
     * 逾期[151-180]天的客户数
     */
    @TableField("overdue_151_180_customers")
    private Integer overdue151To180Customers;
    
    /**
     * 逾期[181+]天的金额
     */
    @TableField("overdue_181_plus_amount")
    private BigDecimal overdue181PlusAmount;
    
    /**
     * 逾期[181+]天的客户数
     */
    @TableField("overdue_181_plus_customers")
    private Integer overdue181PlusCustomers;
    
    /**
     * 逾期总笔数
     */
    @TableField("total_overdue_loans")
    private Integer totalOverdueLoans;
    
    /**
     * 数据类型：MONTHLY-月度数据，CATEGORY-分类数据
     */
    @TableField("data_type")
    private String dataType;
    
    /**
     * 创建时间
     */
    @TableField("created_time")
    private LocalDateTime createdTime;
    
    /**
     * 更新时间
     */
    @TableField("updated_time")
    private LocalDateTime updatedTime;
    
    /**
     * 数据类型枚举
     */
    public enum DataType {
        MONTHLY("MONTHLY", "月度数据"),
        CATEGORY("CATEGORY", "分类数据");
        
        private final String code;
        private final String description;
        
        DataType(String code, String description) {
            this.code = code;
            this.description = description;
        }
        
        public String getCode() {
            return code;
        }
        
        public String getDescription() {
            return description;
        }
    }
}
